﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KC.Framework.Base
{
   
    [Serializable]
    [DataContract(IsReference = true)]
    public abstract class PropertyBase<T> : Entity where T : PropertyAttributeBase 
    {
        public PropertyBase()
        {
            CanEdit = true;
            PropertyAttributeList = new List<T>();
        }

        [Key]
        [DataMember]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)] //数据库生成默认值
        public virtual int PropertyId { get; set; }

        [MaxLength(256)]
        [DataMember]
        public string Name { get; set; }

        [MaxLength(5000)]
        [DataMember]
        public string Description { get; set; }

        [DefaultValue(true)]
        public bool CanEdit { get; set; }

        [DataMember]
        public bool IsRequire { get; set; }

        [DataMember]
        public int Index { get; set; }

        [DataMember]
        public List<T> PropertyAttributeList { get; set; }
    }
}
